<?php

include "connect.php";
$date=$_POST['date'];
$mt_id=$_POST['mt_id'];
$class_id=$_POST['class_id'];
$subject_id=$_POST['subject_id'];
$total_marks=$_POST['total_marks'];
$teacher_id=$_POST['teacher_id'];
$roll_no=$_POST['roll_no'];
$obtain_marks=$_POST['obtain_marks'];

$sq=mysql_query("select * from monthly_test where mt_id='$mt_id'");
while ($row = mysql_fetch_array($sq)) {
	
	$sq2=mysql_query("select * from monthly_test_detail where mt_id='$mt_id' AND roll_no='$roll_no'");
while ($row2 = mysql_fetch_array($sq2))
{
$sql=mysql_query("UPDATE monthly_test SET date='$date',mt_id='$mt_id',class_id='$class_id',subject_id='$subject_id',total_marks='$total_marks',teacher_id='$teacher_id'
  where mt_id='$mt_id'")or die (mysql_error());
  
mysql_query("UPDATE monthly_test_detail SET roll_no='$roll_no',obtain_marks='$obtain_marks'
  where mt_id='$mt_id' AND roll_no='$roll_no'") or die (mysql_error());


}}

header("location:update_monthly_test_success.php");
?>

